package com.cndw.kungfu.vo;

import com.cndw.kungfu.config.ConstantsDayIntKey;
import com.cndw.kungfu.config.ConstantsModel;
import com.cndw.kungfu.domain.Friend;
import com.cndw.kungfu.domain.Player;
import com.cndw.kungfu.domain.Union;
import com.cndw.kungfu.model.Context;

/**
 * 好友vo
 * 
 * @author fantadust
 * @date 2011-5-16 上午11:05:55
 */
public class FriendVO {
	/**
	 * 好友playerId
	 */
	public long friendId;
	/**
	 * 名称
	 */
	public String friendName;
	/**
	 * 昵称
	 */
	public String nickName;

	/**
	 * 职业id
	 */
	public int vocationId;

	/**
	 * 分组id
	 */
	public int groupId;
	/**
	 * 添加时间
	 */
	public int addTime;
	/**
	 * 上次说话时间
	 */
	public int lastTalk;

	/**
	 * 是否在线
	 */
	public boolean onLineStatus;
	/**
	 * 等级
	 */
	public int level;
	/**
	 * 是否祝福
	 */
	public boolean bless;
	
	public int intimacy;
	/**
	 * 武状元等级
	 */
	public int knight;
	/**
	 * 帮派
	 */
	public String un;

	public FriendVO(Friend e) {
		friendId = e.getFriendId();
		friendName = e.getFriendName();
		vocationId = e.getVocationId();
		groupId = e.getGroupId();
		addTime = e.getAddTime();
		lastTalk = e.getLastTalk();
		nickName = e.getNickName();
		onLineStatus = Context.getPlayerServer().isOnline(friendId);
		intimacy = e.getIntimacy();
		Player friend = Context.getPlayerServer().getByPlayerId(e.getFriendId());
		Player player = Context.getPlayerServer().getByPlayerId(e.getPlayerId());
		bless = player.getDataInfo().getEveryDay().getBlessSet().contains(e.getFriendId());
		if (friend != null) {
			level = friend.getLevel();
			friendName = friend.getPlayerName();
			if (friend.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.blessed) >= ConstantsModel.friendBlessNum) {
				bless = true;
			}
			knight = friend.getKnightTrueLevel();
			if (friend.getUnionId() > 0 ) {
				Union union = Context.getUnionServer().getUnionById(friend.getUnionId());
				if (union != null) {
					un  = union.getName();
				}
			}
		}
		

	}

}
